//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _MODEL_MULTITYPEDATACONTAINER_H
#define _MODEL_MULTITYPEDATACONTAINER_H
//
#include <global.h>
#include "multitypedata.h"
#include <common/restoreerror.h>
//
namespace model
{
class MultiTypeDataContainer
{
   //friend QDataStream &operator<<(QDataStream &p_stream,const model::MultiTypeDataContainer &p_data);
   //friend QDataStream &operator>>(QDataStream &p_stream,model::MultiTypeDataContainer &p_data);
//construction
public:
   virtual ~MultiTypeDataContainer();
protected:
   MultiTypeDataContainer();
   MultiTypeDataContainer(MultiTypeData *p_data);
//interface
public:
   void store(QDataStream &p_stream)const;
   void restore(QDataStream &p_stream);
protected:
   static int const type_null=0;
   virtual MultiTypeData *create_data(int p_type)const=0;
   const MultiTypeData *get_data()const;
   MultiTypeData *get_data();
   int get_type()const;
//data
private:
   QExplicitlySharedDataPointer<MultiTypeData> data;
};
}
//
QDataStream &operator<<(QDataStream &p_stream,const model::MultiTypeDataContainer &p_data);
QDataStream &operator>>(QDataStream &p_stream,model::MultiTypeDataContainer &p_data);
//
#endif
